<template>
  <div class="xiangq">
    <div class="xianq-item">
      <span>已选择:{{suk}} </span>
      <div class="xiangq-item-top">
        <div
          v-for="item in list"
          :key="item.id"
        >
          <img
            :src="item.image"
            alt=""
          >
        </div>

        <van-cell
          is-link
          @click="showPopup"
        > 共6种规格可选</van-cell>
        <van-popup
          v-model="show"
          position="bottom"
          :style="{ height: '40%' }"
        >

        </van-popup>
      </div>

    </div>

  </div>
</template>
<script>
export default {
  props: ['id'],
  data() {
    return {
      list: {},
      show: false,
      suk: ""
    }
  },
  methods: {
    showPopup() {
      this.show = true;
    },
    async getxianqin() {
      const res = await this.$http.getxianqin(this.id)
      console.log(res);
      this.list = res.data.data.productValue

      this.list = Object.values(this.list).slice(0,4)
      // console.log(this.list);
      this.suk=this.list[0].suk
    }
  },
  created() {
    this.getxianqin()
    
  }
}
</script>
<style lang="scss" >
.xiangq-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: 10px;
  img {
    width: 30px;
    height: 30px;
    margin-left: 5px;
  }
}
</style>